1. Field of the Invention
The present invention is related to dynamic translation and execution of non-native program code in a virtual hosting environment, and more particularly to techniques for efficiently handling control flow changes while executing translated program code.
2. Description of Related Art
Virtualized computing systems, also known as cloud computing systems, provide large-scale computing functionality in applications such as management of large databases and scientific computing, and large-quantity server functionality in applications such as web page servers and other Internet traffic handling. A virtualized computer system typically provides a platform for executing instances of different operating systems, and hosting multiple applications within each operating systems instance. The computer hardware employed is also virtualized in the sense that multiple distributed processors and local memories form a large-scale multiprocessing system with a distributed system memory.
Dynamic code translation of non-native executables, including operating systems and program code, can be accomplished using code translation, i.e., emulation of the native processor by another processor using translated native code. Such translation provides for execution of the non-native code on processors that provide other native functionality when executing other operating systems/programs and that may provide enhanced performance and/or reduced cost over providing a dedicated processor and operating system that can natively handle the program code that otherwise requires translation.
However, there are several difficulties introduced when performing dynamic translation of non-native program code in a virtualized computing system. Since the guest operating system controls the mapping of guest virtual memory to guest physical memory, the host operating system does not necessarily have access to the mapping information. Further, since the guest operating system controls whether or not the un-translated guest program code is invalidated or modified, the host operating system cannot typically predict the flow of the guest program. In particular, when branch instructions are encountered, if the branch instruction target virtual address is in a different physical memory page than the branch instruction, then the physical code page containing the translated program code corresponding to the un-translated code at the target address must be located and if the page is cached, the page will be accessed. The delay in performing such address resolution may be very high and if the branch instruction is executed many times, the system performance penalty will be significant.
Therefore, it would be desirable to provide a method and program within a computer system that provides dynamic translation and execution of non-native guest programs that accelerates translation of guest code control instruction target virtual addresses.